<%@ page contentType="text/html; charset=utf-8" %>
<%@ include file="/WEB-INF/jsp/com/include/declare.jspf" %>
<%@ include file="/WEB-INF/jsp/com/include/doctype.jspf" %>
<html>
<head>
<script type="text/javascript" src="<c:url value='/common/js/jquery-1.7.1.js'/>"></script>
<script type="text/javascript" src="<c:url value='/common/js/jquery-ui-1.8.16.custom.min.js'/>"></script>
<script type="text/javascript" src="<c:url value='/common/js/jquery-popup.0.2.js'/>"></script>
<script type="text/javascript" src="<c:url value='/common/js/ajaxupload.js'/>"></script>
<script type="text/javascript" src="<c:url value='/common/js/Common.js'/>"></script>

</head>
<script type="text/javascript">

function certFirm()
{

    
    if(!isVaildCheck()) return ;
    //성명을 메인화면에 저장한다.    
    document.extMbrEntForm.mbrNm.value = document.cert1LvlForm.mbrNm.value;
    //주민등록번호를 저장한다.
    var tymdPrx = document.cert1LvlForm.tymdPrx.value;
    var tymdTail = document.cert1LvlForm.tymdTail.value;
    
    var tymdTailP = tymdTail.substring(0,1);
    var tymd = "";
    if((tymdTailP == "1") || (tymdTailP == "2")||(tymdTailP == "5")|| (tymdTailP == "6"))
    {
        tymd = "19" + tymdPrx ;
    }else
    {
        tymd = "20" + tymdPrx ;    
    }
    
    if((tymdTailP == "1")|| (tymdTailP == "3") ||(tymdTailP == "5")||(tymdTailP == "7"))
    {
        document.extMbrEntForm.mbrSex.value = "M";
    }
    else
    {
        document.extMbrEntForm.mbrSex.value = "F";
    }

    var telPrx = document.cert1LvlForm.telPrx.value;
    var telTail = document.cert1LvlForm.telTail.value;
    var mobileCom = document.cert1LvlForm.mobileCom.value;
    var hpNo = mobileCom + telPrx + telTail ;
    
    
    //생년월일을 메인화면에 저장한다
    document.extMbrEntForm.tymd.value = tymd;
    //주민등록번호를 메인화면에 저장한다.
    document.extMbrEntForm.allTymd.value = tymdPrx + tymdTail;
    //통신사구분코드를 메인화면에 저장한다.
    document.extMbrEntForm.mobileComFlg.value = document.cert1LvlForm.mobileComFlg.value;
    //핸드폰번호를 메인화면에 저장한다.
    document.extMbrEntForm.hpNo.value = hpNo ;
    //cef2PopUp("cef2");
    //var closeCef1Popup = new jQuery.Popup().closePopup("cef1"); 
    cef2PopUp("cef1","cef2");
    
    

     
 }
 
 
 function svcComSel( svcComFlg)
 {
     document.cert1LvlForm.mobileComFlg.value = svcComFlg;
     
 }
 
 //데이터의 이상유무를 체크한다.
 function isVaildCheck()
 {
 
     var mbrNm = document.cert1LvlForm.mbrNm.value;
     var tymdPrx = document.cert1LvlForm.tymdPrx.value;
     var tymdTail = document.cert1LvlForm.tymdTail.value;
     var mobileCom = document.cert1LvlForm.mobileCom.value;
     var mobileComFlg = document.cert1LvlForm.mobileComFlg.value;
     var telPrx = document.cert1LvlForm.telPrx.value;
     var telTail = document.cert1LvlForm.telTail.value;
     //핸드폰번호를 변수에 저장한다.
     var hpNo = mobileCom + telPrx + telTail ;
     
     //1. 성명을 체크한다.
     if(mbrNm == "")
     {
         alert("성명을 입력해주십시요");
         document.cert1LvlForm.mbrNm.focus();
         return false;
     }    
     //2. 주민등록번호를 체크한다.
     var tymdTailP = tymdTail.substring(0,1);
     
     
     if( (tymdTailP != "1")&&(tymdTailP != "2")&&(tymdTailP != "3")&&(tymdTailP != "4")&&
             (tymdTailP != "5")&&(tymdTailP != "6")&&(tymdTailP != "7")&&(tymdTailP != "8"))
     {
         alert("주민번호를 정확히 입력하여 주십시요");
         document.cert1LvlForm.tymdTail.focus();
         return false;
     }
     
    
     //3. 통신사를 선택하였는지 체크한다.
     if(mobileComFlg == "")
     {
         alert("통신사를 선택하여 주십시요");
         document.cert1LvlForm.mobileCom.focus();
         return false;     
     }
     //alert("selSvcCom[" + selSvcCom +"]");
     //4. 휴대폰 번호를 체크한다.
     if ((telPrx== "") || (telTail ==""))
     {
         alert("휴대번호를 입력하여 주십시요");
         document.cert1LvlForm.telPrx.focus();
         return false;          
     }
     return true;
 }
 
 
 
function dataLengthCheck(maxLen,obj)
{
    var str= obj.value;
    var cntHan;
    
    cntHan = (escape(str)+"%u").match(/%u/g).length-1;
    
    if(maxLen < (str.length + cntHan))
    {
        alert("총 영숫자  [" + maxLen + "]자, 한글  [" + parseInt(maxLen/2) + "]자 까지 사용하실 수 있습니다. " );
        //입력한 값을 maxLen 길이로 자르기
        while(maxLen < str.length + cntHan)
        {
            str = str.substring(0,str.length-1);
            cntHan = (escape(str)+"%u").match(/%u/g).length-1;
        }
        obj.value = str;
        obj.focus();
        return  false;

  }    
   return true;
    
    
    
}

function numbersOnly(obj)
{
    var str = obj.value;
   
    if(str.length > 0)
    {
        if(isNaN(str) == true )
        {
            alert("숫자만 입력 가능합니다");
            obj.value = "";
            return false;
        }    
    }
    
    return true;
    
}




 
</script>
<body>


<form method="post" action="" name="cert1LvlForm" id="cert1LvlForm" onsubmit="return false" >
<input type="hidden" name="mobileComFlg" id="mobileComFlg" value="">
<input type="hidden" name="tymd" id="tymd" value="">

<div id="main">
    <div id="popup-header">
        <h1><a href="/WEB-INF/index.jsp"><img src="/images/popup/h1_logo.gif" alt="HYUNDAI" /></a></h1>
    </div>
    <div id="popup-contents">
        <h2 class="tit-type02"><img src="/images/popup/h2_certification.gif" alt="본인/휴대폰 인증" /></h2>
        <p><img src="/images/popup/h2_certification_desc.gif" alt="인증을 위하여 입력된 정보는 인증기간인 NICE신용평가정보㈜에 제공하여 본인/휴대폰 인증을 받으며, 현대자동차 홈페이지는 주민등록번호를 따로 저장하지 않습니다." /></p>
        <div class="certification-form subsection02">
            <div class="boardwrite-wrap02 subsection02">
                <table summary="성명, 주민등록번호, 통신사선택, 휴대폰 번호">
                <caption>인증정보 작성</caption>
                <colgroup>
                    <col width="18%" />
                    <col width="15%" />
                    <col />
                </colgroup>
                <tbody>
                <tr>
                    <th scope="row"><img src="/images/popup/txt_certification_01.gif" alt="성명" /></th>
                    <td>
                        <input type="text" class="txt" maxlength="40" name="mbrNm" id="mbrNm" style="width:228px;" onKeyDown="dataLengthCheck(40,this)"/>
                    </td>
                    <td class="tip-txt">본인 실명을 입력하여 주세요.</td>
                </tr>
                <tr>
                    <th scope="row"><img src="/images/popup/txt_certification_02.gif" alt="주민등록번호" /></th>
                    <td>
                        <input type="text" maxlength="6" class="txt" style="width:104px;" name="tymdPrx" id="tymdPrx" onKeyUp="numbersOnly(this)" />
                        -
                        <input type="text" maxlength="7" class="txt" style="width:104px;" name="tymdTail" id="tymdTail"  onKeyUp="numbersOnly(this)" /> 
                    </td>
                    <td class="tip-txt">본인 주민등록번호를 입력하여 주세요.</td>
                </tr>
                <tr>
                    <th scope="row"><img src="/images/popup/txt_certification_03.gif" alt="통신사 선택" /></th>
                    <td>
                        <span class="check-area">
                            <input type="radio" class="check space" id="svcSkt"  name="svcCom" onClick="svcComSel('1')"/>
                            <label for="">SKT</label>
                            <input type="radio" class="check space" id="svcKt" name="svcCom" onClick="svcComSel('2')"/>
                            <label for="">KT</label>
                            <input type="radio" class="check space" id="svcLgu" name="svcCom" onClick="svcComSel('3')"/>
                            <label for="">LG U+</label>
                        </span>
                    </td>
                    <td class="tip-txt">휴대폰의 통신사를 선택합니다.</td>
                </tr>
                <tr>
                    <th scope="row"><img src="/images/popup/txt_certification_04.gif" alt="휴대폰번호" /></th>
                    <td colspan="2">
                        <select class="select select-type1" style="width:56px;" name="mobileCom">
                            <option value="010" selected>010</option>
                            <option value="011">011</option>
                            <option value="016">016</option>
                            <option value="017">017</option>
                            <option value="018">018</option>
                            <option value="019">019</option>
                         
                        </select>
                        -
                        <input type="text" class="txt" style="width:52px;" maxlength="4" name="telPrx" id="telPrx" onKeyUp="numbersOnly(this)"/>
                        -
                        <input type="text" class="txt" style="width:52px;"  maxlength="4" name="telTail" id="telTail" onKeyUp="numbersOnly(this)"/>
                        <input type="image" src="/images/popup/btn_certification.gif" alt="인증요청 " onClick="certFirm()" />
                        <p class="tip">회원님 명의의 휴대폰번호를 입력하며, 아이디/비밀번호 분실 시 사용됩니다.</p>
                    </td>
                </tr>
                </tbody>
                </table>
            </div>
        </div>

    </div>
</div>

</form>
</body>
</html>